package scalaLearning.part3

class Person
case class Student(name:String) extends Person
case class Teacher(name:String,age:Int) extends Person
case class Nobody() extends Person

object CaseClassDemo {
  def main(args: Array[String]): Unit = {
    val tom: Person = new Student("Tom")
    val marry: Person = new Teacher("Marry",30)
    marry match {
      case Student(name) => println("student")
      case Teacher(name,age) => println("Teacher")
      case Nobody() => println("Nobody")
    }
  }
}
